The present invention relates to a method of generating a glyph, and more particularly to a method of generating a new glyph in the style of an existing font, and rendering it, storing it, or adding it to the existing font.
A xe2x80x9ccharacterxe2x80x9d refers to the general concept of a letter, number, symbol, ideograph or the like, without reference to a particular font, whereas a xe2x80x9cglyphxe2x80x9d refers to a specific instance of a character in a font, although these terms are sometimes used interchangeably. A collection of related fonts, e.g., with different weights or point sizes, can be referred to as a xe2x80x9ctypefacexe2x80x9d Digital typefaces and fonts, such as the PostScript(copyright) products available from Adobe Systems Incorporated of San Jose, Calif., generally include instructions for rendering glyphs on an output device, such as a printer or monitor.
With the introduction of a common currency in Europe, a new typographic symbol is needed to represent the new common European currency, the xe2x80x9cEuroxe2x80x9d. Unfortunaltely, most existing fonts do not include a xe2x80x9cEuroxe2x80x9d character. One approach to fixing this problem is for font foundries to distribute new fonts that contain a xe2x80x9cEuroxe2x80x9d character. However, this requires installation of the new font. Furthermore, some fonts are programmed into printers in read-only memory or in such a way that the font cannot be changed without reinstallation and recertification of the printer software. Also, font foundries would need to create hundreds or even thousands of font-specific Euro glyphs to match the existing fonts. Consequently, the font foundries may not update all the digital fonts regularly accessed by a user. Therefore, the user may need to arrange for an existing font to be manually edited using a font editing program, such as Fontographer(trademark), available from Macromedia, to add the xe2x80x9cEuroxe2x80x9d glyph. Unfortunately, this is time consuming and requires special skills the user may not possess, and is expensive if a font programmer must be hired.
Another problem is the rendering of unusual characters xe2x80x9con the flyxe2x80x9d, i.e., generally in real time as a data stream is passed to an output device. For example, some characters, such as Greek letters, are used infrequently and are not included in many fonts. As a result, an unusual character may be rendered with a glyph from another font, or may simply be represented by a place-holder symbol. At best, the output device displays a glyph that does not fit esthetically with the other glyphs in the font.
In general, in one aspect, the invention is directed to a computer-implemented method of generating a glyph. A plurality of design characteristics are extracted from a target font and a source glyph program is generated using the design characteristics. The source glyph program defines a new glyph that is stylistically similar to glyphs of the target font, and the new glyph corresponds to a first character that is not present in the target font.
Implementations of the invention may include one or more of the following. Generating the source glyph program may include applying at least some of the design characteristics to a parameterized source font. The parameterized source font may include a plurality of master glyphs each representing the first character. Generating the source glyph program may include interpolating the master glyphs, and the relative contribution of the master glyphs may be determined from the design characteristics. One of the parameters of the source font may be whether it is serif or sans serif. The parameterized source font may include a plurality of design axes, e.g., weight and width. The parameterized source font may create a source glyph program that defines the new glyph so that it matches the weight, width and serif style of the target font. Generating the source glyph program may include modifying the source glyph program provided by the parameterized source font. The source glyph program may be modified so that the new glyph would match the italic angle, vertical position and horizontal compensation of the target font. The new glyph may be added to the target font, it may be rendered on an output device, or it may be saved separately from the target font.
The method may determine whether the target font is suitable for modification, e.g., by detecting whether the target font already includes the first character. Extracting the plurality of design characteristics may include selecting a model glyph from the target font representing a second character. The second character may have typographic properties similar to the first character to be added to the target font. Design characteristics may be derived from metadata stored in the target font, e.g., italic angle and stem width, from an outline stored in the model glyph, e.g., a height and a width. Design characteristics, such as whether the target font is a serif font, may be derived from a size of the program to generate the model glyph. The second character may be a xe2x80x9ctrademarkxe2x80x9d ((trademark)) character. The first character may be a xe2x80x9ceuroxe2x80x9d character, and the second character may be a xe2x80x9czeroxe2x80x9d character.
A first transformation may be applied to the model glyph to substantially eliminate an italic angle prior to extracting the plurality of design characteristics. A second transformation may be applied to the new glyph so that it has the same italic angle as the target font. A horizontal compensation may be applied to shift the new glyph to match the horizontal compensation of the target font. The new glyph may be scaled vertically to match the height of the model glyph and shifted vertically to match the vertical position of the model glyph.
In another aspect, the invention is directed to a computer-implemented method of modifying a target font. A plurality of design characteristics are extracted from the target font, a source glyph program is generated using the design characteristics, and the source glyph is added to the target font. The source glyph program defines a new glyph that is stylistically similar to glyphs of the target font, and the new glyph corresponds to a first character that is not present in the target font.
In another aspect, the invention is directed to a computer-implemented method of displaying a glyph. A plurality of design characteristics are extracted from a target font, a source glyph program is generated using the design characteristics, and the source glyph is rendered on an output device. The source glyph program defines a new glyph that is stylistically similar to glyphs of the target font, and the new glyph corresponds to a first character that is not present in the target font. The output device may be a printer or a monitor.
In another aspect, the invention is directed to a computer-implemented method of generating a glyph. A character that is not present in a target font is identified, a style of the target font is determined, a glyph that corresponds to the character is received, and the glyph is modified to match the style of the target font. The glyph may be added to the target font or rendered on an output device.
In another aspect, the invention is directed to a computer-implemented method of modifying a font. At least one selected glyph from an existing font that does not contain a Euro glyph is analyzed, an outline of a Euro glyph that appears in style similar to the selected glyph is generated, and the outline of the Euro glyph is modified so that it appears closer in style to the selected glyph. The modified outline of the Euro glyph is added to the font so that an application can render the Euro glyph in a style that is not distinguishable from the style of the glyphs originally present in the font.
In another aspect, the invention is directed to a method of determining whether a font is a serif or sans serif font. A glyph program that represents a character having a number of potential locations for serifs is selected the size of the glyph program is determined, the size of the glyph program is used to indicate whether the is a serif or sans serif font.
Implementations of the invention may include one or more of the following. The font may be indicated as a serif font if the size of the glyph program exceeds, a predetermined value. The character may be a trademark.
In another aspect, the invention is directed to a method of determining a characteristic weight for a font. A glyph program is selected from the font, a stem weight, if present, is extracted from a hint in the glyph program, and the characteristic weight is calculated from the stem weight hint.
If the glyph program does not contain a stem weight hint, a standard vertical width, if present, is extracted from metadata in the target font, and the characteristic weight is determined from the standard vertical width. If the glyph program does not contain a stem weight or standard vertical width, the characteristic weight is determined from a default value.
Implementations of the invention may include one or more of the following. Both a vertical stem weight V and a horizontal stem weight H may be extracted in which case the characteristic weight W may be calculated as W=(H2 +V2)/(H+V) if the font is identified as a sans serif font or as W=max(H,V) if the font is identified as a serif font. A vertical stem weight may be extracted, in which case the characteristic weight may be equal to the vertical stem weight. The method may determine whether the characteristic weight calculated from the stem weight hint exceeds a predetermined fraction of the advance width.
In another aspect, the invention is directed to a computer-implemented method of generating a glyph. In the method, a plurality of design characteristics are extracted from a target font, and a source glyph program is selected from a plurality of glyph programs using the design characteristics. The source glyph program defining a new glyph that is stylistically similar to glyphs of the target font, and corresponds to a character that is not present in the target font.
Implementations of the invention may include the following. One of the design characteristics may be a font name, and selecting the source glyph program may includes determining if one of the plurality of glyph programs is associated with the font name. A backup glyph may be selected based on the design characteristics if none of the plurality of glyph programs is associated with the font name. The design characteristics may include whether the target font is serif or sans serif, and whether the target font is fixed-pitch or variable pitch. A backup sans serif glyph, e.g., a glyph designed in the style of Helvetica, may be selected if the target font is a sans serif font. A backup fixed-pitch serif glyph, e.g., a glyph designed in the style of Courier, may be selected if the target font is a fixed-pitch serif font. A backup variable-pitch serif glyph, e.g., a glyph designed in the style of Times Roman, may be selected if the target font is a variable-pitch serif font. The design characteristics may include whether the target font is italic, bold, or bold and italic. The source glyph program may be added to the target font, rendered on an output device, or saved separately from the target font.
Advantages of the invention include the following. New glyphs that are not part of an existing font can be generated automatically. The new glyph can be added to an existing font quickly and easily while maintaining high fidelity to the style of the existing font. Unusual or new glyphs that conform to the style of an existing font can be generated on the fly.